package b2.widget.fight
{
	import b2.net.*;
	
	import flash.display.Sprite;
	import flash.filters.*;
	import flash.text.*;

	public class PlayerSlot extends Sprite
	{
		public var playerId:int;
		public var playerName:String;
		public var roomPos:int;
		
		private var _lifeNum:int;
		private var _killNum:int;
		private var tankLifeText:TextField;
		private var killRightText:TextField;
		
		public function PlayerSlot(playerId:int, playerName:String, lifeNum:int, roomPos:int)
		{
			super();
			this.playerId = playerId;
			this.playerName = playerName;
			this.roomPos = roomPos;
			var BattlePlayerSlot:Class = ResourceHelper.getInstance().getClassByName("BattlePlayerSlot");
			var playerSlotBgr:Sprite = new BattlePlayerSlot();
			addChild(playerSlotBgr);
			//生命条数
			var TankLifeIcon:Class = ResourceHelper.getInstance().getClassByName("TankLifeIcon");
			var tankLifeIcon:Sprite = new TankLifeIcon();
			tankLifeIcon.width = 15;
			tankLifeIcon.scaleY = tankLifeIcon.scaleX;
			tankLifeIcon.x = 6;
			tankLifeIcon.y = 6;
			addChild(tankLifeIcon);
			tankLifeText = new TextField();
			tankLifeText.selectable = false;
        	tankLifeText.autoSize = TextFieldAutoSize.LEFT;
			tankLifeText.defaultTextFormat = new TextFormat("微软雅黑", 10, 0x00FF00);
			tankLifeText.filters = [new GlowFilter(0x000000, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			tankLifeText.x = 21;
			tankLifeText.y = 7;
			addChild(tankLifeText);
			//击杀
			var killLeftText:TextField = new TextField();
			killLeftText.selectable = false;
        	killLeftText.autoSize = TextFieldAutoSize.LEFT;
			killLeftText.defaultTextFormat = new TextFormat("微软雅黑", 10, 0xFFFFFF);
			killLeftText.filters = [new GlowFilter(0x000000, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			killLeftText.text = "击杀";
			killLeftText.x = 45;
			killLeftText.y = 5;
			addChild(killLeftText);
			killRightText = new TextField();
			killRightText.selectable = false;
        	killRightText.autoSize = TextFieldAutoSize.LEFT;
			killRightText.defaultTextFormat = new TextFormat("微软雅黑", 10, 0x00FF00);
			killRightText.filters = [new GlowFilter(0x000000, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
//			killRightText.text = (00).toString();
			killRightText.x = 72;
			killRightText.y = 5;
			addChild(killRightText);
			//玩家名字
			var playerNameText:TextField = new TextField();
			playerNameText.selectable = false;
        	playerNameText.autoSize = TextFieldAutoSize.LEFT;
			playerNameText.defaultTextFormat = new TextFormat("微软雅黑", 10, 0xFFFF00);
			playerNameText.filters = [new GlowFilter(0x000000, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			playerNameText.text = playerName;
			playerNameText.x = 12;
			playerNameText.y = 33;
			addChild(playerNameText);
			this.lifeNum = lifeNum;
			this.killNum = 0;
		}
		
		public function get lifeNum():int
		{
			return _lifeNum;
		}
		
		public function set lifeNum(lf:int):void
		{
			tankLifeText.text = "×" + lf;
			_lifeNum = lf;
		}
		
		public function get killNum():int
		{
			return _killNum;
		}
		
		public function set killNum(kl:int):void
		{
			killRightText.text = kl.toString();
			_killNum = kl;
		}
		
	}
}